import React from "react"
import {
  View,
  Text,
  TouchableNativeFeedback
} from 'react-native'
import { connect } from 'react-redux';

import { login } from '@/actions/ActionCreators'


class LoginScreen extends React.Component {

  render() {
    return (
      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
        <Text>LoginScreen</Text>
        <TouchableNativeFeedback
            onPress={()=>{
                this.props.dispatch(login({
                    name: 'admin',
                    password: 'asdf'
                }))
            }}
          >
          <View style={{width: 150, height: 50, backgroundColor: 'blue'}}>
            <Text style={{margin: 30}}>Button</Text>
          </View>
        </TouchableNativeFeedback>
      </View>
    );
  }
}

const mapStateToProps = state => ({
  isLoggedIn: state.auth.isLoggedIn,
});

export default connect(mapStateToProps)(LoginScreen);
